﻿using System;

namespace Web.Base.OnlinePays
{
    /// <summary>
    /// 第三方支付平台通知
    /// </summary>
    public class Notification
    {
        /// <summary>
        /// 系统订单号
        /// </summary>
        public string No { get; set; }
        /// <summary>
        /// 支付订单金额(以元为单位)
        /// </summary>
        public decimal Amount { get; set; }
        /// <summary>
        /// 每三方平台订单号
        /// </summary>
        public string ThirdPartyNo { get; set; }
        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime PayDateTime { get; set; }
        /// <summary>
        /// 时间戳
        /// </summary>
        public byte[] Version { get; set; }
        /// <summary>
        /// 签名
        /// </summary>
        public string Signature { get; set; }
        /// <summary>
        /// 银行订单号
        /// </summary>
        public string BankOrderNo { get; set; }

        /// <summary>
        /// 第三方支付平台Id
        /// </summary>
        public int PlatformId { get; set; }

        /// <summary>
        /// 系统处理第三方发来的通知后需回复给第三方支付平台的标识
        /// </summary>
        public string Token { get; set; }

        public Notification(int platformId): this(platformId, string.Empty)
        {
            PlatformId = platformId;
        }

        public Notification(int platformId, string token)
        {
            PlatformId = platformId;
            Token = token;
        }

        public Notification(string no, decimal amount, string thirdPartyNo, DateTime payDateTime, byte[] version, string signature)
        {
            No = no;
            Amount = amount;
            ThirdPartyNo = thirdPartyNo;
            PayDateTime = payDateTime;
            Version = version;
            Signature = signature;
        }
    }
}